<?php
ini_set('max_execution_time', 60);
mysql_connect("127.0.0.1","root","");
mysql_select_db("test");
$time = time();
while((time() - $time) < 30) {
    $res=mysql_query("select * from msg where status=0;");
	if(mysql_num_rows($res)>=1)
	{
		while($v=mysql_fetch_row($res))
			{
			echo json_encode($v);
			}
		break;
	}
	//sleep(5);
}
?>